<?php if(!defined('HDPHP_PATH'))exit;C('SHOW_NOTICE',FALSE);?>
<!DOCTYPE HTML>
<html lang="en-US">
<head>
	<meta charset="UTF-8">
	<title></title>
	<script type="text/javascript" src="http://127.0.0.1/c45_classCode/Static/hdjs/jquery-1.7.2.min.js"></script>
	
	<style type="text/css">
		*{
			list-style: none;
			padding: 0;
			margin:0;
		}
		ul li{
			width:150px; 
			height: 200px;
			border:1px solid #ccc;
			float: left;
			margin-right: 10px;
			border-radius: 8px;
		}
		ul li div.pic{
			width: 150px;
			height: 150px;
		}
		ul li div.pic img{
			width: 150px;
			height: 150px;
		}
		ul li .msg{
			height: 50px;
			font-size: 12px;
			color: #a5a5a5;
		}
		ul li .msg p{
			line-height: 15px;
		}

		.active{
			border:1px solid red;
		}
	</style>	
</head>
<body>
	<ul id="style">
		        <?php
        //初始化
        $hd['list']['d'] = array(
            'first' => false,
            'last'  => false,
            'total' => 0,
            'index' => 0
        );
        if (empty($dirs)) {
            echo '';
        } else {
            $listId = 0;
            $listShowNum=0;
            $listNextId=0;
            foreach ($dirs as $d) {
                //开始值
                if ($listId<0) {
                    $listId++;
                    continue;
                }
                //步长
                if($listId!=$listNextId){$listId++;continue;}
                //显示条数
                if($listShowNum>=100)break;
                //第几个值
                $hd['list'][d]['index']++;
                //第1个值
                $hd['list'][d]['first']=($listId == 0);
                //最后一个值
                $hd['list'][d]['last']= (count($dirs)-1 <= $listId);
                //总数
                $hd['list'][d]['total']++;
                //增加数
                $listId++;
                $listShowNum++;
                $listNextId+=1
                ?>
			<li class="<?php echo $d['active'];?>" stylename="<?php echo $d['filename'];?>">
				<div class="pic">
					<img src="<?php echo $d['pic'];?>" alt="">
				</div>
				<div class="msg">
					<p><?php echo $d['msg']['author'];?></p>
					<p><?php echo $d['msg']['stylename'];?></p>
					<p><?php echo $d['msg']['qq'];?></p>
				</div>
			</li>
		<?php }}?>
	</ul>
	<script type="text/javascript">
		$(function(){
			$('#style li').click(function(){
				stylename = $(this).attr('stylename');
				_this = $(this);
				$.ajax({
					url:"<?php echo U('Config/ajaxChang');?>",
					data:{stylename:stylename},
					dataType:'json',
					type:'post',
					success:function(data){
						if(data.status==1){
							$('#style li').removeClass('active');
							_this.addClass('active');
						}
					}
				})
			})
		})
	</script>	
</body>
</html>